package com.taoye.study;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author Mr.Tao
 * @version 1.0.0
 * @ClassName Executor.java
 * @Description TODO
 * @createTime 2022年03月17日 09:24:00
 */
public class Executor {
    
    
    public static void main(String[] args) {
        ArrayBlockingQueue<Runnable> runnable = new ArrayBlockingQueue<Runnable>(5);
        ThreadPoolExecutor pool = new ThreadPoolExecutor(2,5,5L,
                TimeUnit.SECONDS,runnable);

        for (int i = 0; i < 20; i++) {
            pool.execute(()->{
                System.out.println(Thread.currentThread().getName()+":"+11);
            });
        }
    }
}
